import App from './App'
import messages from './locale/index'
import uView from "uview-ui";
import store from './store/index.js';
import user from './utils/user.js';
import login from './utils/login.js';


let i18nConfig = {
    locale: uni.getLocale(),
    messages
}
// #ifndef VUE3
import Vue from 'vue'
import VueI18n from 'vue-i18n'
Vue.use(VueI18n)
const i18n = new VueI18n(i18nConfig)
import './uni.promisify.adaptor'
Vue.config.productionTip = false
App.mpType = 'app'

Vue.mixin({
    mounted() {
        /* if (this.isWeiXinBrowser() || this.isQQBrowser()) {
            this.navTitle();//当需要去掉顶部的栏目时候
        } */
    },
    methods: {
        isWeiXinBrowser() {
			 // #ifdef MP-WEIXIN
			return true; // 直接返回微信小程序环境
			// #endif
			
			// #ifdef H5
			const ua = navigator.userAgent.toLowerCase();
			return ua.indexOf('micromessenger') !== -1;
			// #endif
			
			return false;
        },
        isQQBrowser() {
            var ua = navigator.userAgent.toLowerCase()
            if (ua.match(/QQ/i) == "qq") {
                return true
            } else {
                return false
            }
        },
        navTitle() {
            this.$nextTick(() => {
                let navTitleDom = document.getElementsByTagName('uni-page-head')
                if (navTitleDom.length) {
                    navTitleDom[0].style.display = 'none'
                }
            })
        }
    }
})
Vue.use({
	install(Vue, options) {
		// Vue.prototype.$sysAppid = sysAppid; //appid
		Vue.prototype.$store = store;
		Vue.prototype.$user = user;
		Vue.prototype.$login = login;
		// Vue.prototype.$platform = platform;
		// Vue.prototype.$jwx = jwx;
		//Vue.prototype.$mallConfig = mallConfig; // 商城配置
	},
});
Vue.use(uView);

const app = new Vue({
    i18n,
  ...App
})
app.$mount()
// #endif

// #ifdef VUE3
import { createSSRApp } from 'vue'
import { createI18n } from 'vue-i18n'
const i18n = createI18n(i18nConfig)
export function createApp() {
  const app = createSSRApp(App)
  app.use(i18n)
  return {
    app
  }
}
// #endif